<?php
    header("Content-type: text/html; charset=utf-8");
    $localhost = 'localhost';
    $usernamesql = 'root';
    $passwordsql = 'root';
    $conn = mysqli_connect($localhost, $usernamesql, $passwordsql);
    //应用数据库
    $query='use bigmelon';
    mysqli_query($conn,$query);
    $username=$_GET['username'];
    $password=$_GET['password'];
    die("$username");
    $tel=$_GET['tel'];
    $captch=$_GET['captcha'];
    $query="select * from melon where tel ='$tel'";
    $res=mysqli_query($conn,$query);
    if($res){
        die('0');//用户名已存在
    }
    else {
        $query="insert into melon (tel,username,password,tel_active) values ('$tel','$username','$password','$capth')";
        mysqli_query($conn,$query);
        die('1');//注册成功
    }

?>